import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { ErpCostOutInfoVO, ErpCostOutInfoForm, ErpCostOutInfoQuery } from '@/api/erp/erpCostOutInfo/types';

/**
 * 查询支出明细列表
 * @param query
 * @returns {*}
 */

export const listErpCostOutInfo = (query?: ErpCostOutInfoQuery): AxiosPromise<ErpCostOutInfoVO[]> => {
  return request({
    url: '/erp/erpCostOutInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询支出明细详细
 * @param id
 */
export const getErpCostOutInfo = (id: string | number): AxiosPromise<ErpCostOutInfoVO> => {
  return request({
    url: '/erp/erpCostOutInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增支出明细
 * @param data
 */
export const addErpCostOutInfo = (data: ErpCostOutInfoForm) => {
  return request({
    url: '/erp/erpCostOutInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改支出明细
 * @param data
 */
export const updateErpCostOutInfo = (data: ErpCostOutInfoForm) => {
  return request({
    url: '/erp/erpCostOutInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除支出明细
 * @param id
 */
export const delErpCostOutInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/erp/erpCostOutInfo/' + id,
    method: 'delete'
  });
};
